
cd "/Users/emanuelcoman/Dropbox/My Mac (Emanuel’s MacBook Pro)/Documents/italy_participation/reproduction_psrm/"

*Figure 1
use "participation_2001_2020.dta", clear
		
		twoway  (connected w_p year, mcolor(gray) msize(small) lcolor(gray) lpattern(dash) lwidth(thin)) ///
				(connected m_p year, mcolor(black) msize(small) lcolor(black) lpattern(dash) lwidth(thin)) ///
				(connected av_loc_f_part year, mcolor(gray) msize(small)  lcolor(gray) lwidth(thin)) ///
				(connected av_loc_m_part year, mcolor(black) msize(small) lcolor(black) lwidth(thin)),  ///
				 graphregion(color(white)) ylab(,nogrid)  legend(size(small)) ytitle("Turnout rates") xtitle("") xscale(range(2000 2019)) ///
				 xlabel(2001(1)2020, labsize(small) angle(90))
				 

			 graph export "Figure1.pdf", replace
	
	
*Figure 2

use "participation_final93_20.dta", clear

	graph hbar (count), over(year, label(labsize(small))) blabel(bar, format(%2.0f)) ///
			  legend(off) graphregion(color(white)) yscale(r(0 5500)) ylab(,nogrid nolabel) ytitle("") title("Elections by year")
			
			
graph export "Figure2.pdf", replace


**Table 1: RD with population threshold of 1000

cls
use "data_to_run_psrm3.dta", clear
keep if loc_id==1

rdrobust m_minus_f P2 if year>=2013, c(-4000) h(100)
rdrobust m_minus_f P2 if year>=2013, c(-4000) h(200)
rdrobust m_minus_f P2 if year>=2013, c(-4000) h(300)
rdrobust m_minus_f P2 if year>=2013, c(-4000) h(400)
rdrobust m_minus_f P2 if year>=2013, c(-4000) h(500)

translate @Results Table1.txt, replace

**Table 2
cls
use "census_1991_2001.dta", clear

		rddensity n_P1 if year==2001, c(5000)

		rddensity n_P1 if year==2011, c(5000)
		
		rddensity n_P1 if year==2011|year==2001, c(5000)
		
translate @Results Table2.txt, replace


*Table 3
cls
use "census_1991_2001.dta", clear

	*population by age groups
	
		**general: under 25; 25-44; 45-64; over 65
		egen tot_under_25=rowtotal(n_P14-n_P18)
		egen tot_25_44=rowtotal(n_P19-n_P22)
		egen tot_45_64=rowtotal(n_P23-n_P26)
		egen tot_over_64=rowtotal(n_P27-n_P29)
		
		*males
		egen m_under_25=rowtotal(n_P30-n_P34)
		egen m_25_44=rowtotal(n_P35-n_P38)
		egen m_45_64=rowtotal(n_P39-n_P42)
		egen m_over_64=rowtotal(n_P43-n_P45)
		
		*females
		gen f_under_25=tot_under_25-m_under_25
		gen f_25_44=tot_25_44-m_25_44
		gen f_45_64=tot_45_64-m_45_64
		gen f_over_64=tot_over_64-m_over_64
		
		foreach x of varlist tot_under_25-tot_over_64 {
		gen perc_`x'=`x'/n_P1*100
		}
		
		foreach x of varlist f_under_25-f_over_64 {
		gen perc_`x'=`x'/n_P3*100
		}
		
	gen perc_females=n_P3/n_P1*100 /*percent of females in locality*/
	
	*****percent university educated for those living for more than 6 years
	gen perc_univ=n_P47/n_P46*100
	
	**compute number of women living for more than 6 years
	gen female_6years=n_P46-n_P53
	
	**percent university educated for women living for more than 6 years
	gen females_uni=n_P47-n_P54
	gen perc_f_univ=females_uni/female_6years*100
			
			
	****UNEMPLOYMENT
	
	gen perc_unemp=n_P62/n_P60*100
	
		*unemployment for women
		gen f_work_force=n_P60-n_P64
		gen f_unemployed=n_P62-n_P66
		gen perc_f_unemp=f_unemployed/f_work_force*100
		
		
*some analyses with 2001 and 2011 censuses combined

keep  year n_P1 PRO_ perc*
foreach x of varlist perc* {
rdrobust `x' n_P1 if year!=1991&n_P1<15000, c(5000)
	
	putexcel set `x'.xlsx
}	

use "data_to_run_psrm3.dta", clear
keep if loc_id==1

rdrobust fem_perc P2 if year<2013&popolaz<15000


translate @Results Table3.txt, replace


**Figure 5

use "data_to_run_psrm3.dta", clear
sort prov com year
drop if prov==prov[_n-1]&com==com[_n-1]&year==year[_n-1]

**gen averages for the main dependent variables in bins of 4 individuals as population
**there are 2500 groups of 4 individuals if we consider popoulation between 0 and 10000

gen group50=.

forvalues i=1/2500 {

replace group50=`i' if P>0&P/2>=`i'-1&P/2<`i'+1

replace group50=`i'*-1 if P<0&P/-2>=`i'-1&P/-2<`i'+1

}

	*generate averages within bins for our dependent variables

	by R group50, sort: egen m_minus_f_25=mean(m_minus_f)

	drop if group50==.
	
	
drop if R==R[_n-1]&group50==group50[_n-1]

***subtract before reform from after reform
sort group50 R
by group50, sort: gen m_minus_f_25_new=m_minus_f_25-m_minus_f_25[_n-1]
drop m_minus_f_25
rename m_minus_f_25 m_minus_f_25
drop if R==0


gen population2=group50*2



rdplot m_minus_f_25 population2, kernel(uniform)

ssc install cmogram, replace

rename population2 Normalized_Population
rename m_minus_f_25 Participation_Gap

cmogram Participation_Gap Normalized_Population, cut(0) scatter lineat(0) lfit 


graph export "figure5.pdf", replace


***Table 4

use "data_to_run_psrm3.dta", clear

keep if loc_id==1

		*select the bandwidth
	rdbwselect fem_perc P2 if popolaz>1000&popolaz<10000&m_minus_f!=. 
	
	***First stage
	reg fem_perc R##T##c.P2 if P2>-1290&P2<1290, vce(cluster locality) 
	
	*second stage
	ivregress 2sls m_minus_f (fem_perc = R P2 T RxT RxP2 TxP2 RxTxP2) if P2>-1290&P2<1290, vce(cluster locality)

translate @Results Table4.txt, replace


*** Table 5

ivregress 2sls f_part_adj2 (fem_perc = R P2 T RxT RxP2 TxP2 RxTxP2) if P2>-1290&P2<1290, vce(cluster locality) 

ivregress 2sls m_part_adj2 (fem_perc = R P2 T RxT RxP2 TxP2 RxTxP2) if P2>-1290&P2<1290, vce(cluster locality)

translate @Results Table5.txt, replace



							******APPENDIX*****
***Figure A1: Placebo tests

ssc install svret, replace	
			
			**first the positive values, that is artificial thresholds above the 5000 threshold
			estimates clear
forvalues i=100(100)1000 {  
use "data_to_run_psrm3.dta", clear
keep if loc_id==1
rename P2 old_P
rename placebo_`i' P2
rdbwselect fem_perc P2 if old_P>0 /*we only look on one side of the threshold*/

svret,long format(%8.2fc)
keep if variable=="e(h_mserd)"
replace contents=subinstr(contents, ",","",.)
gen band=real(contents)
keep band
gen nr=1
save "band`i'.dta", replace /*this document just stores the rdbwselect values*/

use "data_to_run_psrm3.dta", clear
keep if loc_id==1

rename P2 old_P
rename placebo_`i' P2
gen nr=1
capture drop _merge
merge m:m nr using "band`i'.dta"
gen band_neg=band*-1

drop T
gen T=.
replace T=0 if P2<0
replace T=1 if P2>=0 

drop RxT RxP2 TxP2 RxTxP2

gen RxT=R*T
gen RxP2=R*P2
gen TxP2=T*P2
gen RxTxP2=R*T*P2

rename RxT placebo_`i'


reg fem_perc R T P2 placebo_`i' RxP2 TxP2 RxTxP2 if old_P>0&P2>band_neg&P2<band, vce(cluster locality)

estimates store placebo_`i'
}


****now the negative values
forvalues i=100(100)1000 {
use "data_to_run_psrm3.dta", clear
keep if loc_id==1

rename P2 old_P
rename placebo_neg`i' P2
rdbwselect fem_perc P2 if old_P<0 /*we only look on one side of the threshold*/
svret,long format(%8.2fc)
keep if variable=="e(h_mserd)"
replace contents=subinstr(contents, ",","",.)
gen band=real(contents)
keep band
gen nr=1
save "bandneg`i'.dta", replace /*this document just stores the rdbwselect values*/

use "data_to_run_psrm3.dta", clear
keep if loc_id==1

rename P2 old_P
rename placebo_neg`i' P2
gen nr=1
capture drop _merge
merge m:m nr using "bandneg`i'.dta"
gen band_neg=band*-1


drop T
gen T=.
replace T=0 if P2<0
replace T=1 if P2>=0 

drop RxT RxP2 TxP2 RxTxP2

gen RxT=R*T
gen RxP2=R*P2
gen TxP2=T*P2
gen RxTxP2=R*T*P2

rename RxT placebo_neg`i'

reg fem_perc R T P2 placebo_neg`i' RxP2 TxP2 RxTxP2 if old_P<0&P2>band_neg&P2<band, vce(cluster locality)

estimates store placebo_neg`i'
}

				esttab  placebo_* placebo_neg* ///
							using placebos.csv, ///
							ci keep (placebo* placebo_neg*) replace 

**Bring back the results to clean them
	
import delimited "placebos.csv", stripquote(yes) clear
			
drop in 1/2
*drop in 1/2
foreach x of varlist _all{

	replace `x' = subinstr(`x',"=","",.)
	replace `x' = subinstr(`x',"[","",.)
	replace `x' = subinstr(`x',"]","",.)
	replace `x' = subinstr(`x',"*","",.)
}

keep v1-v21

gen coef=v2+v3+v4+v5+v6+v7+v8+v9+v10+v11+v12+v13+v14+v15+v16+v17+v18+v19+v20+v21
		
***retrieve the N
		
		foreach var of varlist v2-v21 {
		
		replace `var'="" if _n!=41 /*this is the line with the N*/
		}
	
		
	replace coef="" if v1=="N"
	split coef, p(",")
	
	
drop coef
	gen lower_bound2=coef1 if v1==""
	rename coef2 upper_bound2
	gen b2=coef1 if v1!=""
	replace upper_bound=upper_bound[_n+1] if upper_bound==""
	replace lower_bound=lower_bound[_n+1] if lower_bound==""
	drop if v1==""
	

split v1, p("placebo_") gen(sample)


save "placebos_provisional.dta", replace


**create a file with the number of observations
use "placebos_provisional.dta", clear
keep v2-v21
keep in 21
		sxpose, clear		
	
	gen N=real(_var1)
	keep N
	gen merge_nr=_n
	sort merge_nr
	
	save "placebos_observations.dta", replace
	
	
****bring back the dataset with regressions coefficients, and add the N variable
	
	use "placebos_provisional.dta", clear
keep v1 coef1-sample2
	
	
	gen merge_nr=_n
	
	
	gen b=real(b)
	gen upper_bound=real(upper_bound)
	gen lower_bound=real(lower_bound)
	keep sample2 lower_bound upper_bound b  merge_nr
	rename sample sample
	move lower upper

	sort merge_nr
	merge merge_nr using "placebos_observations.dta"
	keep if _merge==3
	drop _merge merge_nr
	
	gen placebo=real(sample)
	replace placebo=-100 if sample=="neg100"
	replace placebo=-200 if sample=="neg200"
	replace placebo=-300 if sample=="neg300"
	replace placebo=-400 if sample=="neg400"
	replace placebo=-500 if sample=="neg500"
	replace placebo=-600 if sample=="neg600"
	replace placebo=-700 if sample=="neg700"
	replace placebo=-800 if sample=="neg800"
	replace placebo=-900 if sample=="neg900"
	replace placebo=-1000 if sample=="neg1000"


	
	
	sort placebo
	
***graph it
mkmat b lower_bound upper_bound, mat(placebos)
 coefplot (matrix(placebos[,1]), ci((placebos[,2] placebos[,3]))), ///
		rename(r1 =4000 r2=4100 r3=4200 r4=4300 r5=4400 r6=4500 ///
		r7 =4600 r8=4700 r9=4800 r10=4900 r11=5100 r12=5200 ///
		r13=5300 r14=5400 r15=5500 r16=5600 r17=5700 r18=5800 r19=5900 r20=6000) xline(0) ///
		graphregion(color(white)) ylab(,nogrid) ytitle("Threshold")
 
 graph export "FigureA1.pdf", replace
 
 
 ***TAble A1: main analyses with various bandwidth bw 1000 and 3000
 


cls
forvalues i=1000(200)3000{
use "data_to_run_psrm3.dta", clear
keep if loc_id==1

	reg fem_perc R T P2 RxT RxP2 TxP2 RxTxP2 if P2>-`i'&P2<`i', vce(cluster locality)
estimates store band_1_`i'

	ivregress 2sls m_minus_f (fem_perc= R T P2 RxT RxP2 TxP2 RxTxP2) if P2>-`i'&P2<`i', vce(cluster locality)
	
	}

	translate @Results TableA1.txt, replace
	
	
*** Table A2:donut hole analyses

cls

use "data_to_run_psrm3.dta", clear
keep if loc_id==1

*Radius 100
drop if P>-100&P<100
		*select bandwidht
	rdbwselect fem_perc P if popolaz>1000&popolaz<10000&m_minus_f!=. /*1262*/

	reg fem_perc R T P RxT RxP TxP RxTxP if P>-1262&P<1262, robust

	ivregress 2sls m_minus_f (fem_perc= R T P RxT RxP TxP RxTxP) if P>-1262&P<1262, robust
	
*Radius 200

drop if P>-200&P<200
		*select bandwidht
	rdbwselect fem_perc P if popolaz>1000&popolaz<10000&m_minus_f!=. /*1230*/

	reg fem_perc R T P RxT RxP TxP RxTxP if P>-1230&P<1230, robust

	ivregress 2sls m_minus_f (fem_perc= R T P RxT RxP TxP RxTxP) if P>-1230&P<1230, robust
	
*Radius 300

drop if P>-300&P<300
		*select bandwidht
	rdbwselect fem_perc P if popolaz>1000&popolaz<10000&m_minus_f!=. /*1284*/

	reg fem_perc R T P RxT RxP TxP RxTxP if P>-1284&P<1284, robust

	ivregress 2sls m_minus_f (fem_perc= R T P RxT RxP TxP RxTxP) if P>-1284&P<1284, robust	
	
*Radius 400

drop if P>-400&P<400
		*select bandwidht
	rdbwselect fem_perc P if popolaz>1000&popolaz<10000&m_minus_f!=. /*1486*/

	reg fem_perc R T P RxT RxP TxP RxTxP if P>-1486&P<1486, robust

	ivregress 2sls m_minus_f (fem_perc= R T P RxT RxP TxP RxTxP) if P>-1486&P<1486, robust	
	
*Radius 500

drop if P>-500&P<500
		*select bandwidht
	rdbwselect fem_perc P if popolaz>1000&popolaz<10000&m_minus_f!=. /*1896*/

	reg fem_perc R T P RxT RxP TxP RxTxP if P>-1896&P<1896, robust

	ivregress 2sls m_minus_f (fem_perc= R T P RxT RxP TxP RxTxP) if P>-1486&P<1486, robust	

		translate @Results TableA2.txt, replace

	
***Table A3 

use "data_to_run_psrm3.dta", clear

gen two_thirds=2/3*total

by prov com year, sort: gen nr1=1
replace nr1=nr1[_n-1]+1 if prov==prov[_n-1]&com==com[_n-1]&year!=year[_n-1]


replace two_thirds=ceil(two_thirds)

gen over_two_thirds=.
replace over_two_thirds=0 if males<=two_thirds
replace over_two_thirds=1 if males>two_thirds			
		
		keep if year>=2008
		*before reform
by T, sort: tab over_two_thirds if R==0

		*after reform
		
by T, sort: tab over_two_thirds if R==1



	****See the same compliance among treated units for the first, second and third election only

 tab over_two_thirds if R==1&T==1&elec_nr_R==1
tab over_two_thirds if R==1&T==1&elec_nr_R==2
tab over_two_thirds if R==1&T==1&elec_nr_R==3

		translate @Results TableA3.txt, replace


****Table A4

use "data_to_run_psrm3.dta", clear

keep if year>2007

**number of locality/elections

sum R if fem_perc!=.&m_minus_f!=.&P!=.&R!=.

***number of locality/elections pre-reform
sum R if fem_perc!=.&m_minus_f!=.&P!=.&R==0

***number of locality/elections post-reform
sum R if fem_perc!=.&m_minus_f!=.&P!=.&R==1


*number of locality/elections, untreated observations
sum R if fem_perc!=.&m_minus_f!=.&P!=.&T==0

*number of locality/elections, untreated observations before reform
sum R if fem_perc!=.&m_minus_f!=.&P!=.&T==0&R==0

*number of locality/elections, untreated observations after reform
sum R if fem_perc!=.&m_minus_f!=.&P!=.&T==0&R==1


*number of locality/elections, treated observations
sum R if fem_perc!=.&m_minus_f!=.&P!=.&T==1

*number of locality/elections, treated observations before reform
sum R if fem_perc!=.&m_minus_f!=.&P!=.&T==1&R==0

*number of locality/elections, untreated observations after reform
sum R if fem_perc!=.&m_minus_f!=.&P!=.&T==1&R==1


****Number of localities
		**All localities
		
		use "data_to_run_psrm3.dta", clear

keep if year>2007
sort prov com
drop if prov==prov[_n-1]&com==com[_n-1]

sum R if fem_perc!=.&m_minus_f!=.&P!=.&R!=.

		**all localities untreated
sum R if fem_perc!=.&m_minus_f!=.&P!=.&R!=.&T==0
		*all localities treated
sum R if fem_perc!=.&m_minus_f!=.&P!=.&R!=.&T==1

		*Localities before reform
		use "data_to_run_psrm3.dta", clear

keep if year>2007&year<2013
sort prov com
drop if prov==prov[_n-1]&com==com[_n-1]

		*all localities
sum R if fem_perc!=.&m_minus_f!=.&P!=.&R!=.

		**all localities untreated
sum R if fem_perc!=.&m_minus_f!=.&P!=.&R!=.&T==0
		*all localities treated
sum R if fem_perc!=.&m_minus_f!=.&P!=.&R!=.&T==1	

		*Localities after reform
			use "data_to_run_psrm3.dta", clear

keep if year>2012
sort prov com
drop if prov==prov[_n-1]&com==com[_n-1]

		*all localities
sum R if fem_perc!=.&m_minus_f!=.&P!=.&R!=.

		**all localities untreated
sum R if fem_perc!=.&m_minus_f!=.&P!=.&R!=.&T==0
		*all localities treated
sum R if fem_perc!=.&m_minus_f!=.&P!=.&R!=.&T==1		
		
		
*****women on ballot
use "data_to_run_psrm3.dta", clear


keep if loc_id==1

drop if P>10000 /*population under 15,000 only*/

	*all women
sum fem_perc 

	*women in untreated localities
sum fem_perc if P<0

	*women in treated localities
sum fem_perc if P>=0


**women on ballot pre-reform only
sum fem_perc if year<2013

	*women in untreated localities pre-reform
sum fem_perc if P<0&year<2013

	*women in treated localities pre-reform
sum fem_perc if P>=0&year<2013

**women on ballot post reform only
sum fem_perc if year>2012

	*women in untreated localities post-reform
sum fem_perc if P<0&year>2012

	*women in treated localities post-reform
sum fem_perc if P>=0&year>2012


		***participation gap
			
sum m_minus_f if m_part!=0 

	*untreated localities
sum m_minus_f if m_part!=0&P<0

	*treated localities
sum m_minus_f if m_part!=0&P>=0


		**participation gap pre-reform
sum m_minus_f if m_part!=0&year<2013

	*pre-reform, untreated localities
sum m_minus_f if m_part!=0&year<2013&P<0

	*pre-reform, treated localities
sum m_minus_f if m_part!=0&year<2013&P>=0


		**participation gap post-reform
sum m_minus_f if m_part!=0&year>2012

	*post-reform, untreated localities
sum m_minus_f if m_part!=0&year>2012&P<0

	*post-reform, treated localities
sum m_minus_f if m_part!=0&year>2012&P>=0


****numbert of elections per locality

use "data_to_run_psrm3.dta", clear


keep if loc_id==1
keep if year>2007

*gen a variable counting the number of elections in each election

by prov com, sort: egen tot_elec=count(R) if fem_perc!=.&m_minus_f!=.&P!=.&R!=.

*gen a variable countint the number of elections pre-reform in each locality
by prov com, sort: egen elec_preR=count(R) if fem_perc!=.&m_minus_f!=.&P!=.&R==0
gsort prov com elec_preR
by prov com, sort: replace elec_preR=elec_preR[_n-1] if elec_preR==.
recode elec_preR(.=0)

*gen a variable countint the number of elections post-reform in each locality
by prov com, sort: egen tot_elec=count(R) if fem_perc!=.&m_minus_f!=.&P!=.&R!=.

*gen a variable countint the number of elections pre-reform in each locality
by prov com, sort: egen elec_postR=count(R) if fem_perc!=.&m_minus_f!=.&P!=.&R==1
gsort prov com elec_postR
by prov com, sort: replace elec_postR=elec_postR[_n-1] if elec_postR==.
recode elec_postR(.=0)

sort prov com
drop if prov==prov[_n-1]&com==com[_n-1]

***summarize total number of elections per locality
sum tot_elec
***summarize total number of elections per locality, untreated localities
sum tot_elec if T==0
***summarize total number of elections per locality, treated localities
sum tot_elec if T==1

***summarize total number of elections per locality before reform
sum tot_elec if R==0
***summarize total number of elections per locality before reform, untreated localities
sum tot_elec if T==0&R==0
***summarize total number of elections per locality before reform, treated localities
sum tot_elec if T==1&R==0

***summarize total number of elections per locality after reform
sum tot_elec if R==1
***summarize total number of elections per locality after reform, untreated localities
sum tot_elec if T==0&R==1
***summarize total number of elections per locality after reform, treated localities
sum tot_elec if T==1&R==1

		translate @Results TableA4.txt, replace
		

		*TAble A5
		use "data_to_run_psrm3.dta", clear

		keep if loc_id==1
		
		*incumbent lists	
		reg fem_part_inc R##T##c.P2 if P2>-1290&P2<1290&fem_part_not_inc!=., vce(cluster locality) 
	ivregress 2sls m_minus_f (fem_part_inc= R P2 T RxT RxP2 TxP2 RxTxP2) if P2>-1290&P2<1290 &fem_part_not_inc!=., vce(cluster locality)
		
		*non incumbent lists
		reg fem_part_not_inc R##T##c.P2 if P2>-1290&P2<1290&fem_part_inc!=., vce(cluster locality) 
	ivregress 2sls m_minus_f (fem_part_not_inc= R P2 T RxT RxP2 TxP2 RxTxP2) if P2>-1290&P2<1290&fem_part_inc!=., vce(cluster locality)	
	
		translate @Results TableA5.txt, replace

	
		*Table A6
		use "data_to_run_psrm3.dta", clear

		keep if loc_id==1
		
gen first_post_elec=0
	replace first_post_elec=1 if R==1&elec_nr_R==1 /*this variable denotes the first election in each locality after the reform*/

		*first election post-reform
 reg fem_perc R##T##c.P2 if P2>-1290&P2<1290&first_post_elec==1&R==1|P2>-1290&P2<1290&R==0, vce(cluster locality) 
	
ivregress 2sls m_minus_f (fem_perc = R P T RxT RxP TxP RxTxP) if P2>-1290&P2<1290&first_post_elec==1&R==1|P2>-1290&P2<1290&R==0, vce(cluster locality)

		*following elections post-reform
reg fem_perc R##T##c.P2 if P2>-1290&P2<1290&first_post_elec==0&R==1|P2>-1290&P2>-1290&P2<1290&R==0, vce(cluster locality) 

ivregress 2sls m_minus_f (fem_perc = R P T RxT RxP TxP RxTxP) if P2>-1290&P2<1290&first_post_elec==0&R==1|P2>-1290&P2<1290&R==0, vce(cluster locality)

		translate @Results TableA6.txt, replace


		*Table A8

		use "data_to_run_psrm3.dta", clear

		keep if loc_id==1
		
		*gen a variable with percent of women elected
gen w_m_elected=women_elected/(women_elected+men_elected)*100

sort locality year
drop if locality==locality[_n-1]&year==year[_n-1]
xtset locality year

xtreg w_m_elected f_part_adj, fe 

		translate @Results TableA7.txt, replace


		*Table A9
		use "data_to_run_psrm3.dta", clear

		keep if loc_id==1
		
		rdbwselect fem_perc P2 if P2<2000&P2>-2000&year>2007 /*547.193*/

	reg fem_perc R##T##c.P2 if P2>-547&P2<547, vce(cluster locality) /* 7.21*/
 *N=1,099

ivregress 2sls m_minus_f (fem_perc = R P2 T RxT RxP2 TxP2 RxTxP2) if P2>-547&P2<547, vce(cluster locality)


		translate @Results TableA8.txt, replace
